package com.kly.test.function.home

import android.graphics.RenderEffect
import android.graphics.Shader
import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import com.kly.test.base.adpater.AdapterCallback
import com.kly.test.databinding.ItemHomeListBinding
import com.kly.test.model.HomeListDataBean
import com.kly.test.util.Injections.transformRounded20Top
import com.kly.test.util.load

class HomeDataListViewHolder(
    parent: ViewGroup,
    callback: AdapterCallback,
    private val binding: ItemHomeListBinding = ItemHomeListBinding.inflate(
        LayoutInflater.from(parent.context),
        parent,
        false,
    )
) : RecyclerView.ViewHolder(binding.root) {

    @RequiresApi(Build.VERSION_CODES.S)
    fun bind(item: HomeListDataBean, position: Int) {
        binding.txtItemListName.text = item.nickname
        binding.imgItemListTop.setRenderEffect(
            RenderEffect.createBlurEffect(
                80f,
                80f,
                Shader.TileMode.CLAMP
            )
        )
//        binding.imgItemListTop.load(
//            item.head,
//            transformation = transformRounded20Top
//        )
    }

}